// support.js
class Container { 
    static of (value) {
        return new Container(value)
    }
    constructor(value) {
        this._value = value
    }
    map (fn) {
        return Container.of(fn(this._value))
    }
}

class MayBe{
    static of (value){
        return new MayBe(value)
    }
    constructor(value){
        this._value=value
    }
    //如果为空值 直接返回null
    map(fn){
        return this.isnothing()?MayBe.of(null):MayBe.of(fn(this._value))
    }
    isnothing(){
        return this._value===null||this._value===undefined
    }
}
module.exports = {
    MayBe,
    Container
}